<div class="inmodal">
    <div class="modal-header">
        <h4 class="modal-title">{{operation | translate}}(ID:{{combinedequipmentparameter.id}})</h4>
    </div>
    <div class="modal-body">
        <form role="form" name="form_combinedequipmentparameter" novalidate class="form-horizontal">
            <div class="form-group">
              <label class="col-sm-4 control-label">{{'COMBINED_EQUIPMENT.PARAMETER_NAME' | translate}}<span class="text-danger">*</span></label>
                <div class="col-sm-8"><input ng-model="combinedequipmentparameter.name" type="text" name="combinedequipmentparametername" class="form-control" required="">
                    <div class="m-t-xs" ng-show="form_combinedequipmentparameter.combinedequipmentparametername.$invalid && form_combinedequipmentparameter.combinedequipmentparametername.$dirty">
                        <small class="text-danger" ng-show="form_combinedequipmentparameter.combinedequipmentparametername.$error.required">{{'COMBINED_EQUIPMENT.INPUT_PARAMETER_NAME' | translate}}</small>
                    </div>
                </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group">
              <label class="col-sm-4 control-label">{{'COMBINED_EQUIPMENT.PARAMETER_TYPE' | translate}}</label>
                <div class="col-sm-8">
                    <select ng-disabled="is_disabled" name="combinedequipment_parameter_type"  ng-model="combinedequipmentparameter.parameter_type" class="form-control m-b">
                                <option value="constant">{{'COMBINED_EQUIPMENT.CONSTANT' | translate}}</option>
                                <option value="point">{{'COMBINED_EQUIPMENT.POINT' | translate}}</option>
                                <option value="fraction">{{'COMBINED_EQUIPMENT.FRACTION' | translate}}</option>
                    </select>
                    <div class="m-t-xs" ng-show="form_combinedequipmentparameter.combinedequipmentparameter.parameter_type.$invalid && form_combinedequipmentparameter.combinedequipmentparameter.parameter_type.$dirty">
                        <small class="text-danger" ng-show="form_combinedequipmentparameter.combinedequipmentparameter.parameter_type.$error.required">{{'COMBINED_EQUIPMENT.SELECT_PARAMETER_TYPE' | translate}}</small>
                    </div>
                </div>
            </div>
            <div class="hr-line-dashed" ng-show=" combinedequipmentparameter.parameter_type=='constant' "></div>
            <div class="form-group" ng-show=" combinedequipmentparameter.parameter_type=='constant' ">
              <label class="col-sm-4 control-label">{{'COMBINED_EQUIPMENT.CONSTANT' | translate}}</label>
              <div class="col-sm-8">
                  <input ng-model="combinedequipmentparameter.constant" type="text" name="combinedequipmentparameterconstant" class="form-control" >
                  <div class="m-t-xs" ng-show="form_combinedequipmentparameter.combinedequipmentparameterconstant.$invalid && form_combinedequipmentparameter.combinedequipmentparameterconstant.$dirty">
                      <small class="text-danger" ng-show="form_combinedequipmentparameter.combinedequipmentparameterconstant.$error.required">{{'COMBINED_EQUIPMENT.INPUT_CONSTANT' | translate}}</small>
                  </div>
              </div>
            </div>
            <div class="hr-line-dashed" ng-show=" combinedequipmentparameter.parameter_type=='point' "></div>
            <div class="form-group" ng-show=" combinedequipmentparameter.parameter_type=='point' " >
              <label class="col-sm-4 control-label">{{'COMBINED_EQUIPMENT.POINT' | translate}}</label>
                <div class="col-sm-8">
                    <ui-select ng-model="combinedequipmentparameter.point.id" name="combinedequipmentparameter.point_id" theme="bootstrap">
                        <ui-select-match allow-clear="false" placeholder="{{'COMMON.PLACEHOLDER' | translate}}">{{$select.selected.name}}</ui-select-match>
                        <ui-select-choices repeat="point.id as point in points | filter: $select.search">
                            <div ng-bind-html="point.name | highlight: $select.search"></div>
                        </ui-select-choices>
                    </ui-select>
                    <div class="m-t-xs" ng-show="form_combinedequipmentparameter.point_id.$invalid && form_combinedequipmentparameter.point_id.$dirty">
                        <small class="text-danger" ng-show="form_combinedequipmentparameter.point_id.$error.required">{{'COMBINED_EQUIPMENT.SELECT_POINT' | translate}}</small>
                    </div>
                </div>
            </div>
            <div class="hr-line-dashed"  ng-show=" combinedequipmentparameter.parameter_type=='fraction' "></div>
            <div class="form-group"  ng-show=" combinedequipmentparameter.parameter_type=='fraction' ">
              <label class="col-sm-4 control-label">{{'COMBINED_EQUIPMENT.PARAMETER_NUMERATOR_METER' | translate}}<span class="text-danger">*</span></label>
                <div class="col-sm-8">
                    <ui-select ng-model="combinedequipmentparameter.numerator_meter.uuid" name="combinedequipmentparameter.numerator_meter_uuid" theme="bootstrap" required>
                        <ui-select-match allow-clear="false" placeholder="{{'COMMON.PLACEHOLDER' | translate}}">{{$select.selected.name}}</ui-select-match>
                        <ui-select-choices repeat="meter.uuid as meter in mergedmeters | filter: $select.search">
                            <div ng-bind-html="meter.name | highlight: $select.search"></div>
                        </ui-select-choices>
                    </ui-select>
                </div>
            </div>
            <div class="hr-line-dashed"  ng-show=" combinedequipmentparameter.parameter_type=='fraction' "></div>
            <div class="form-group"  ng-show=" combinedequipmentparameter.parameter_type=='fraction' ">
              <label class="col-sm-4 control-label">{{'COMBINED_EQUIPMENT.PARAMETER_DENOMINATOR_METER' | translate}}<span class="text-danger">*</span></label>
                <div class="col-sm-8">
                    <ui-select ng-model="combinedequipmentparameter.denominator_meter.uuid" name="combinedequipmentparameter.denominator_meter_uuid" theme="bootstrap" required>
                        <ui-select-match allow-clear="false" placeholder="{{'COMMON.PLACEHOLDER' | translate}}">{{$select.selected.name}}</ui-select-match>
                        <ui-select-choices repeat="meter.uuid as meter in mergedmeters  | filter: $select.search">
                            <div ng-bind-html="meter.name | highlight: $select.search"></div>
                        </ui-select-choices>
                    </ui-select>
                </div>
            </div>
        </form>
    </div>
    <div class="modal-footer">
        <button type="button" class="btn btn-white" ng-click="cancel()">{{'SETTING.CANCEL' | translate}}</button>
        <button type="button" ng-disabled="(combinedequipmentparameter.parameter_type === 'constant' && (!combinedequipmentparameter.name || !combinedequipmentparameter.constant)) || 
                                            (combinedequipmentparameter.parameter_type === 'point' && (!combinedequipmentparameter.name || !combinedequipmentparameter.point.id)) || 
                                            (combinedequipmentparameter.parameter_type === 'fraction' &&  (!combinedequipmentparameter.name || !combinedequipmentparameter.numerator_meter.uuid || !combinedequipmentparameter.denominator_meter.uuid)) "
        class="btn btn-primary" ng-click="ok()">{{'SETTING.SAVE' | translate}}</button>
    </div>
</div>
